-
-
Notifications
You must be signed in to change notification settings - Fork 40
Beta2 community Release [Beta2] 2024-07-01 #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: community-edition
Are you sure you want to change the base?
Conversation
Signed-off-by: StepSecurity Bot <[email protected]>
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 12727652 | Triggered | PostgreSQL Credentials | 32ad759 | Dockerfile | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
…n_1721745950 [StepSecurity] Apply security best practices
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
| const response = await axios.put(`/api/teams/${slug}/csc`, { | ||
| control, | ||
| value, | ||
| }); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, the slug value should be validated or restricted before being used in the URL. The best approach is to use an allow-list (whitelist) of acceptable slug values, ensuring that only predefined, trusted values can be used. This prevents attackers from injecting arbitrary or malicious values.
Steps to fix:
- Define an allow-list of valid
slugvalues that the application expects. - Validate the
slugvalue against the allow-list before constructing the URL. - If the
slugvalue is not valid, handle the error gracefully (e.g., return an error response or log the issue).
-
Copy modified lines R51-R53 -
Copy modified lines R60-R64 -
Copy modified line R79
| @@ -50,2 +50,5 @@ | ||
|
|
||
| const validSlugs = useMemo(() => ['team1', 'team2', 'team3'], []); // Define allow-list | ||
| const isValidSlug = validSlugs.includes(slug as string); // Validate slug | ||
|
|
||
| const controlOptions = useMemo(() => getControlOptions(ISO), [ISO]); | ||
| @@ -56,2 +59,7 @@ | ||
| const statusHandler = useCallback(async (control: string, value: string) => { | ||
| if (!isValidSlug) { | ||
| toast.error('Invalid team slug.'); | ||
| return; | ||
| } | ||
|
|
||
| const response = await axios.put(`/api/teams/${slug}/csc`, { | ||
| @@ -70,3 +78,3 @@ | ||
| setStatuses(data.statuses); | ||
| }, []); | ||
| }, [isValidSlug]); | ||
|
|
| response = await axios.put( | ||
| `/api/teams/${slug}/tasks/${task.taskNumber}/csc`, | ||
| { | ||
| controls: [newControl], | ||
| operation: 'add', | ||
| ISO, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to ensure that the slug value is validated against a trusted allow-list or sanitized before being used in the URL. This will prevent attackers from injecting malicious values into the URL.
The best approach is to:
- Define a trusted allow-list of valid
slugvalues. - Validate the
slugvalue against this allow-list before using it in the URL. - If the
slugvalue is invalid, handle the error gracefully (e.g., show an error message or redirect the user).
The changes will be made in the CscPanel component, specifically in the controlHanlder and deleteControls functions where the slug value is used.
-
Copy modified lines R42-R44 -
Copy modified lines R66-R70 -
Copy modified lines R101-R106
| @@ -41,3 +41,5 @@ | ||
| const router = useRouter(); | ||
| const { slug } = router.query; | ||
| const { slug: rawSlug } = router.query; | ||
| const allowedSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| const slug = allowedSlugs.includes(rawSlug) ? rawSlug : null; | ||
|
|
||
| @@ -63,2 +65,7 @@ | ||
| const deleteControls = useCallback(async () => { | ||
| if (!slug) { | ||
| toast.error('Invalid team identifier.'); | ||
| return; | ||
| } | ||
|
|
||
| setIsDeleting(true); | ||
| @@ -93,2 +100,8 @@ | ||
| if (oldControl === '') { | ||
| if (!slug) { | ||
| toast.error('Invalid team identifier.'); | ||
| setIsSaving(false); | ||
| return; | ||
| } | ||
|
|
||
| response = await axios.put( |
| response = await axios.put( | ||
| `/api/teams/${slug}/tasks/${task.taskNumber}/csc`, | ||
| { | ||
| controls: [oldControl, newControl], | ||
| operation: 'change', | ||
| ISO, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to ensure that the slug value is validated against a predefined allowlist of acceptable values before it is used in the URL. This approach ensures that only trusted and expected values are used, preventing attackers from injecting malicious input.
Steps to implement the fix:
- Define an allowlist of valid
slugvalues that the application expects. - Validate the
slugvalue against this allowlist before using it in the URL. - If the
slugvalue is not valid, handle the error gracefully (e.g., show an error message or redirect the user).
-
Copy modified lines R43-R47
| @@ -42,2 +42,7 @@ | ||
| const { slug } = router.query; | ||
| const allowedSlugs = ['team1', 'team2', 'team3']; // Example allowlist | ||
| if (!allowedSlugs.includes(slug)) { | ||
| toast.error('Invalid team identifier.'); | ||
| return; | ||
| } | ||
|
|
| const response = await axios.post<ApiResponse<Task>>( | ||
| `/api/teams/${slug}/tasks/${task.taskNumber}/rpa`, | ||
| { | ||
| prevProcedure: prevProcedure, | ||
| nextProcedure: procedure, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to ensure that the slug value is validated against a predefined allow-list of acceptable values before it is used in the URL. This approach ensures that only known and trusted values can be used, preventing attackers from injecting malicious input.
Steps to fix:
- Define an allow-list of valid
slugvalues. This could be a hardcoded array or fetched from a trusted source. - Validate the
slugvalue against the allow-list before constructing the URL. - If the
slugvalue is invalid, handle the error gracefully (e.g., show an error message or redirect the user).
-
Copy modified lines R30-R31 -
Copy modified lines R50-R55 -
Copy modified line R57
| @@ -29,2 +29,4 @@ | ||
| const { slug } = router.query; | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list of valid slugs | ||
| const validatedSlug = validSlugs.includes(slug) ? slug : null; | ||
|
|
||
| @@ -47,4 +49,10 @@ | ||
|
|
||
| if (!validatedSlug) { | ||
| toast.error(t('invalid-slug')); | ||
| setIsLoading(false); | ||
| return; | ||
| } | ||
|
|
||
| const response = await axios.post<ApiResponse<Task>>( | ||
| `/api/teams/${slug}/tasks/${task.taskNumber}/rpa`, | ||
| `/api/teams/${validatedSlug}/tasks/${task.taskNumber}/rpa`, | ||
| { |
| const response = await axios.post<ApiResponse<Task>>( | ||
| `/api/teams/${slug}/tasks/${task.taskNumber}/rpa`, | ||
| { | ||
| prevProcedure: prevProcedure, | ||
| nextProcedure: procedure, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to ensure that the slug value is validated against a predefined allow-list of acceptable values before it is used in the URL. This approach ensures that only known and trusted values are allowed, preventing attackers from injecting malicious input.
Steps to fix:
- Define an allow-list of valid
slugvalues. This could be a hardcoded list or dynamically fetched from a trusted source. - Validate the
slugvalue against the allow-list before using it in the URL. - If the
slugvalue is invalid, handle the error gracefully (e.g., show an error message or redirect the user).
-
Copy modified lines R32-R36
| @@ -31,2 +31,7 @@ | ||
| const { slug } = router.query; | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list of valid slugs | ||
| if (!validSlugs.includes(slug)) { | ||
| toast.error(t('invalid-slug')); // Show an error message for invalid slugs | ||
| return; | ||
| } | ||
|
|
| const response = await axios.put<ApiResponse<unknown>>( | ||
| `/api/teams/${slug}/tasks/${taskNumber}/comments`, | ||
| { | ||
| id, | ||
| text, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the issue, we need to ensure that the slug and taskNumber values are validated before being used in the URL. This can be achieved by implementing an allow-list for slug and ensuring taskNumber is a valid numeric value. The allow-list should contain predefined valid slug values that the application expects, and any unrecognized values should be rejected. This approach prevents attackers from injecting arbitrary values into the URL.
Changes to be made:
- Introduce validation logic for
slugandtaskNumberbefore constructing the URL. - Reject or sanitize invalid values to prevent SSRF attacks.
-
Copy modified lines R30-R35 -
Copy modified line R79
| @@ -29,2 +29,8 @@ | ||
| const { slug, taskNumber } = router.query; | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| const sanitizedSlug = validSlugs.includes(slug) ? slug : null; | ||
| const sanitizedTaskNumber = /^\d+$/.test(taskNumber) ? taskNumber : null; | ||
| if (!sanitizedSlug || !sanitizedTaskNumber) { | ||
| throw new Error('Invalid slug or task number'); | ||
| } | ||
| const [commentToEdit, setCommentToEdit] = useState<number | null>(null); | ||
| @@ -72,3 +78,3 @@ | ||
| const response = await axios.put<ApiResponse<unknown>>( | ||
| `/api/teams/${slug}/tasks/${taskNumber}/comments`, | ||
| `/api/teams/${sanitizedSlug}/tasks/${sanitizedTaskNumber}/comments`, | ||
| { |
| const response = await axios.delete<ApiResponse<unknown>>( | ||
| `/api/teams/${slug}/tasks/${taskNumber}/comments`, | ||
| { | ||
| data: { | ||
| id, | ||
| }, | ||
| } | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the issue, we need to validate and sanitize the slug and taskNumber values before using them to construct the URL. This can be achieved by:
- Defining an allow-list of acceptable
slugvalues and ensuring that theslugmatches one of these values. - Validating that
taskNumberis a numeric value, as it appears to represent a task identifier.
The fix will involve:
- Adding validation logic for
slugandtaskNumberbefore constructing the URL. - Rejecting or handling invalid inputs gracefully to prevent SSRF vulnerabilities.
-
Copy modified lines R29-R36
| @@ -28,3 +28,10 @@ | ||
| const router = useRouter(); | ||
| const { slug, taskNumber } = router.query; | ||
| const { slug: rawSlug, taskNumber: rawTaskNumber } = router.query; | ||
| const allowedSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| const slug = typeof rawSlug === 'string' && allowedSlugs.includes(rawSlug) ? rawSlug : null; | ||
| const taskNumber = typeof rawTaskNumber === 'string' && /^\d+$/.test(rawTaskNumber) ? rawTaskNumber : null; | ||
| if (!slug || !taskNumber) { | ||
| toast.error('Invalid task or team identifier.'); | ||
| return; | ||
| } | ||
| const [commentToEdit, setCommentToEdit] = useState<number | null>(null); |
| const response = await axios.delete( | ||
| `/api/teams/${teamSlug}/tasks/${taskNumber}/attachments?id=${attachment.id}` | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to validate or sanitize the user-provided values (taskNumber and teamSlug) before using them in the URL. The best approach is to use an allow-list of acceptable values for these parameters. This ensures that only known, trusted values are used in the request.
Steps to fix:
- Introduce validation logic to check
taskNumberandteamSlugagainst an allow-list or predefined set of acceptable values. - Reject or handle invalid values gracefully, preventing them from being used in the URL.
- Apply this validation in the
DeleteAttachmentcomponent before constructing the URL.
-
Copy modified lines R33-R41
| @@ -32,2 +32,11 @@ | ||
|
|
||
| const allowedTeamSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| const allowedTaskNumbers = ['123', '456', '789']; // Example allow-list | ||
|
|
||
| if (!allowedTeamSlugs.includes(teamSlug) || !allowedTaskNumbers.includes(taskNumber)) { | ||
| toast.error('Invalid team or task number.'); | ||
| setIsLoading(false); | ||
| return; | ||
| } | ||
|
|
||
| const response = await axios.delete( |
| const response = await axios.delete<ApiResponse<unknown>>( | ||
| `/api/teams/${slug}/tasks/${taskNumber}` | ||
| ); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the SSRF vulnerability, we need to validate or sanitize the slug value before using it in the URL. The best approach is to use an allow-list of valid slug values. This ensures that only predefined, trusted values can be used in the URL, effectively mitigating the risk of SSRF.
Steps to implement the fix:
- Define an allow-list of valid
slugvalues. - Check if the
slugvalue fromrouter.queryis in the allow-list. - If the
slugvalue is not valid, handle the error appropriately (e.g., show an error message or redirect the user). - Use the validated
slugvalue in the URL.
-
Copy modified lines R21-R23 -
Copy modified lines R32-R35
| @@ -20,3 +20,5 @@ | ||
| const router = useRouter(); | ||
| const { slug } = router.query; | ||
| const { slug: rawSlug } = router.query; | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| const slug = validSlugs.includes(rawSlug as string) ? (rawSlug as string) : null; | ||
| const { mutateTasks } = useTasks(slug as string); | ||
| @@ -29,2 +31,6 @@ | ||
| onSubmit: async () => { | ||
| if (!slug) { | ||
| toast.error(t('invalid-slug')); | ||
| return; | ||
| } | ||
| const response = await axios.delete<ApiResponse<unknown>>( |
| const response = await axios.put(`/api/teams/${slug}/csc`, { | ||
| control, | ||
| value, | ||
| }); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the issue, we need to validate or sanitize the slug value before using it in the URL of the outgoing HTTP request. The best approach is to use an allow-list of valid slug values, ensuring that only known and trusted values are used. This prevents attackers from injecting malicious input into the URL.
Steps to implement the fix:
- Define an allow-list of valid
slugvalues, either as a hardcoded list or by fetching them from a trusted source (e.g., a database or configuration file). - Before making the HTTP request, check if the
slugvalue is in the allow-list. - If the
slugis not valid, handle the error gracefully (e.g., show an error message or redirect the user).
-
Copy modified lines R67-R71 -
Copy modified lines R94-R98
| @@ -66,2 +66,7 @@ | ||
| async (control: string, value: string) => { | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| if (!validSlugs.includes(slug)) { | ||
| toast.error('Invalid team identifier.'); | ||
| return; | ||
| } | ||
| const response = await axios.put(`/api/teams/${slug}/csc`, { | ||
| @@ -88,2 +93,7 @@ | ||
| const taskNumber = option.value; | ||
| const validSlugs = ['team1', 'team2', 'team3']; // Example allow-list | ||
| if (!validSlugs.includes(slug)) { | ||
| toast.error('Invalid team identifier.'); | ||
| return; | ||
| } | ||
| const response = await axios.put( |
No description provided.